using UnityEditor;
using UnityEngine;

namespace Runtime.Module.GameGraphic.Editor
{
    public class IsScriptCtrlEditor<T> : UnityEditor.Editor where T : Component
    {
        protected IsScriptCtrlEditorData<T> editorData;

        protected virtual void OnEnable()
        {
            if (!target)
            {
                Debug.LogError($"{typeof(T)}=====>脚本异常====");
                return;
            }

            editorData = new IsScriptCtrlEditorData<T>(serializedObject, (T)target);
            // editorData.NodeInfoCtrlName = SetNodeInfoCtrlName();
            // editorData.SetScriptSet();
        }

        public virtual string SetNodeInfoCtrlName()
        {
            return editorData?.NodeInfoCtrlStr;
        }

        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();
        }

        public virtual void OnInspectorGUIOfScript()
        {
            editorData?.OnInspectorGUIOfScript();
        }

        protected virtual void OnDisable()
        {
            editorData = null;
        }
    }
}